<?php

namespace apiend\modules\passport\controllers;

use Yii;
use apiend\components\Controller;
use apiend\modules\passport\models\CaptchaValidateForm;
use apiend\modules\passport\models\AuthMenuSearch;
use common\helpers\Url;

/**
 * 短信验证码校验
 * @author emhome <emhome@163.com>
 * @since 2.0
 */
class AccountController extends Controller {

    /**
     * @inheritdoc
     */
    protected function verbs() {
        return [
            'index' => ['GET'],
            '*' => ['POST'],
        ];
    }

    /**
     * 帐号信息
     * @return mixed
     */
    public function actionIndex() {
        return $this->user;
    }

    /**
     * 校验短信验证码
     * @return mixed
     */
    public function actionCheck() {
        $model = new CaptchaValidateForm();
        if (!$model->load(Yii::$app->request->post(), '')) {
            parent::error('请输入短信验证码');
        }
        $model->user_id = $this->uid;
        return $model->check();
    }

}
